/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.tintuna.cca.property;

import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import org.openide.nodes.PropertySupport;
import org.tintuna.cca.data.Row;
import org.tintuna.cca.node.RowNode;

/**
 *
 * @author bsmith
 */
public class DateProperty extends PropertySupport.ReadWrite<Date> {

    Row row;

    public DateProperty(Row row) {
        super(RowNode.DATE_PROPERTY, Date.class, "Transaction date", "The date of the transaction");
        this.row = row;
    }

    @Override
    public Date getValue() throws IllegalAccessException, InvocationTargetException {
        return row.getDate();
    }

    @Override
    public void setValue(Date t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        System.out.println("New Date:" + t.toString());
        row.setDate(t);
    }
}
